<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<script src="${ctx}/resources/plugin/ratyli/jquery.ratyli.js"></script>
<script type="text/javascript">
        $(function(){
            $("#merchant_main tr:gt(0)").click(function(){
 	    	   if($(this).find(":radio").attr("checked")=="checked"){
 	    		     $(this).find(":radio").attr("checked",false);
 		    	   }else{
 		             $(this).find(":radio").attr("checked",true);
 		    	   }
            });
        });
    </script>
<!-- 顶部模块[如：功能按钮、搜索面板] -->
<div class="bjui-pageHeader" style="background: #FFF;">
	<form id="pagerForm" data-toggle="ajaxsearch"
		action="${ctx}/bus/merchant/doList" method="post">
		<input type="hidden" name="pageSize" value="${pageResult.pageSize}">
		<input type="hidden" name="pageCurrent" value="${pageResult.pageCurrent}"> 
		<input type="hidden" name="orderField" value="${pageResult.orderField}">
		<input type="hidden" name="orderDirection" value="${pageResult.orderDirection}">
		<div style="margin-top: 5px;">
			<!-- 刷新按钮-->
			<button class="btn btn-orange" data-icon="refresh">刷新</button>
		
			<!-- 编辑按钮-->
			<shiro:hasPermission name="editMerchant">
				<a href="${ctx}/bus/merchant/searchMerchantDetail?id={#bjui-selected}&flag=edit"
					class="btn btn-blue" data-icon="edit" data-toggle="dialog"
					data-width="900" data-height="600" data-id="dialog-user"
					data-mask="true">编辑</a>
			</shiro:hasPermission> 
		</div>
		<hr style="margin-top: 5px; margin-bottom: 5px">
		<div style="margin-bottom: 5px">
			<label>商户名称：<input id="merchantName" type="text"value="${pageResult.ext.merchantName }" name="merchantName"
				placeholder="请输入商户名称" style="width: 140px;"  /></label> 
			<label>商户联系电话：<input id="phone" type="text"value="${pageResult.ext.phone }" name="phone"
			placeholder="请输入商户手机号码" style="width: 140px;"  /></label> 
				<label>企业名称：<input id="enterpriseName" type="text"value="${pageResult.ext.enterpriseName }" name="enterpriseName"
			placeholder="请输入企业名称" style="width: 140px;"  /></label> 
			<label>审核状态：
				<select data-toggle="selectpicker" name="checkStatus">
				<option value="">全部</option>
					<c:forEach items="${checkStatusList}" var="checkStatus">
							<c:choose>
								<c:when test="${checkStatus.codeValue == pageResult.ext.checkStatus}">
									<option value="${checkStatus.codeValue }" selected >${checkStatus.codeName }</option>
								</c:when>
								<c:otherwise>
									<option value="${checkStatus.codeValue }" >${checkStatus.codeName }</option>
								</c:otherwise>
							</c:choose>
							
					</c:forEach>
			</select> 
			</label>
		
			<button class="btn-default" data-icon="search">查询</button>
		</div>
	</form>
	<!-- 	<div id="demo1">
	  <span class="ratyli" data-rate="2" data-ratemax="5"></span>
	</div> -->
	<script type="text/javascript">
		$("#demo1 .ratyli").ratyli();
	</script>
</div>
<!-- 内容区 -->
<div class="bjui-pageContent tableContent" id="merchant_main">
	<table id="doc-datagrid-table" 
		class="table table-bordered table-hover table-striped table-top">
		<thead>
			<tr class="m_th_row">
				<th>选择</th>
				<th>商户名称</th>
				<th>手机号码</th>
				<th>法人名称</th>
				<th>法人联系电话</th>
				<th>注册日期</th>
				<th>提现手续费（%）</th>
				<th>审核状态</th>
				<th>查看详情</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${pageResult.list}" var="u">
				<tr data-id="${u.id}" class="m_th_row">
					<td><input name="merchant_main" type="radio"  /></td>
					<td>${u.merchantName} </td><!-- -->
					<td>${u.phone}</td>
					<td>${u.legalName}</td>
					<td>${u.legalPhone}</td>
					<td><fmt:formatDate value="${u.registerTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
					<td>${u.cashPoundage}</td>
					<%-- <td>${u.checkStatusName}</td> --%>
					<td>${u.checkStatusName }</td>
					<td>
						<c:if test="${u.checkStatus==1 }">
							<button type="button" class="btn btn-default" data-toggle="dialog"
							data-options="{id:'orderDetailDialog',url:'${ctx}/bus/merchant/checkMerchant',type:'post',data:{id:${u.id}}}"
							data-width="900" data-height="600" data-id="dialog-user-role"
							data-title="${u.merchantName}审核">审核</button>
						</c:if>
						
						<button type="button" class="btn btn-default" data-toggle="dialog"
							data-options="{id:'orderDetailDialog',url:'${ctx}/bus/merchant/searchMerchantDetail',type:'post',data:{id:${u.id}}}"
							data-width="900" data-height="600" data-id="dialog-user-role"
							data-title="${u.merchantName}详情">详情</button>
					</td>
				</tr>
			</c:forEach>

		</tbody>
	</table>
</div>
<!-- 底部模块[如：工具条、分页组件]  -->
<div class="bjui-pageFooter">
	<div class="pages">
		<span>每页 </span>
		<div class="selectPagesize">
			<select data-toggle="selectpicker"
				data-toggle-change="changepagesize">
				<option value="10">10</option>
				<option value="30">30</option>
				<option value="60">60</option>
				<option value="100">100</option>
			</select>
		</div>
		<span> 条，共 ${pageResult.total} 条</span>
	</div>
	<div class="pagination-box" data-toggle="pagination"
		data-total="${pageResult.total}"
		data-page-size="${pageResult.pageSize}"
		data-page-current="${pageResult.pageCurrent}"></div>
</div>

